﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace TestWindowsGame1
{
    class OrientedPhysics
    {
        public bool hasGravity;
        public bool isGrounded;
        public bool canJump; //To be removed in later versions
        public Vector2 myGrav;
        public float maxV_Magnitude;
        public Vector2 AddForce;
        public Vector2 Accelerate;
        public float VDrag;
        public Vector2 DragForce;

        public OrientedPhysics(bool grav)
        {
            hasGravity = grav;
            isGrounded = false;
            canJump = true; //For debugging only
            maxV_Magnitude = 4.0f;
            AddForce = Vector2.Zero;
            Accelerate = Vector2.Zero;
            DragForce = Vector2.Zero;
            if (hasGravity)
            {
                myGrav = new Vector2(0, 0.05f);
                VDrag = 3;
            }
            else
            {
                myGrav = Vector2.Zero;
                VDrag = 1;
            }
        }

        public void update(int d_time)
        {
            AddForce = (myGrav - Accelerate) * d_time;
            if (Accelerate.Y > 0)
            {
                Accelerate.Y -= 0.01f;
            }
            if (Accelerate.Y < 0)
            {
                Accelerate.Y = 0;
            }
        }
    }
}
